import plugin from '../../../lib/plugins/plugin.js';
import puppeteer from '../../../lib/puppeteer/puppeteer.js';

export class HotPluginHelp extends plugin {
  constructor() {
    super({
      name: '热搜帮助',
      dsc: '提供热搜查询的帮助信息',
      event: 'message',
      priority: 5000,
      rule: [
        {
          reg: "^#?(热搜帮助)",
          fnc: 'help'
        },
      ]
    });
  }

  async help(e) {
    let cwd = `${process.cwd()}/plugins/hot-plugin/html/help`;
    cwd = cwd.replace(/\\/g, '/');

    let data = {
      quality: 100,
      tplFile: `./plugins/hot-plugin/html/help/help.html`,
      鸡鸡地址: cwd
    };

    try {
      let img = await puppeteer.screenshot("HotPluginHelp", {
        ...data,
      });
      e.reply(img);
    } catch (error) {
      console.error('帮助菜单生成失败:', error);
      e.reply('帮助信息无法显示，请稍后再试。');
    }
  }
}